home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / dbms_mag / 9102 / foxpro2.feb < prev    next >
Text File  |  1990-12-19  |  1KB  |  41 lines

  1.  
  2. PROCEDURE DumpMemo
  3. ***********************************************************
  4. * Program :  DumpMemo.Prg
  5. * Author  :  P. L. Olympia & Kathy Cea
  6. * Purpose :  Copies contents of selected records of a
  7. *         :  specified memo field to a target file.
  8. * Syntax  :  DO DumpMemo WITH DbfName, MemFld, RecBeg,
  9. *         :     RecEnd, OutFile
  10. *         :  RecBeg & RecEnd are the beginning and ending
  11. *         :  record numbers to copy. Outfile is the target
  12. *         :  file.  DbfName is the .dbf file. MemFld is the
  13. *         :  memo field.
  14. * Note    :  Error trapping excluded from code.
  15. ***********************************************************
  16. PARAMETER DbfName, MemFld, RecBeg, RecEnd, Outfile
  17.  
  18. *-- Store, then change,  environment
  19.  SafeSW = SET("SAFETY") 
  20.  SET SAFETY OFF
  21.  
  22.  rec_str   = STR(RecBeg,4)      && for use as macro
  23.  
  24. *-- We need the following two statements to make sure
  25. *   OutFile is created if not already present
  26.  
  27.  SET ALTERNATE TO (OutFile)  && Note filename substitution
  28.  CLOSE ALTERNATE
  29.  
  30.  USE (DbfName)                  && Another indirect file 
  31.  &rec_str                       &&  move pointer to start
  32.  
  33.  SCAN  WHILE (recno() >= RecBeg .AND. recno() <= RecEnd ;
  34.          .AND. !(EMPTY(MemFld))) 
  35.     COPY MEMO &MemFld TO (OutFile) ADDITIVE  && Exports memo 
  36.  ENDSCAN
  37.  
  38.  SET SAFETY &SafeSW
  39.  RETURN
  40.  
  41.